import { request } from '@/plugins/request';

// global tags
export function getTags() {
  return request({
    method: 'GET',
    url: '/api/tags'
  });
}

// global list
export function getArticles(params) {
  return request({
    method: 'GET',
    url: '/api/articles',
    params
  });
}

// feed list
export function getFeedArticles(params) {
  return request({
    method: 'GET',
    url: '/api/articles/feed',
    params
  });
}

// 点赞
export function addFavorite(slug) {
  return request({
    method: 'POST',
    url: `/api/articles/${slug}/favorite`,
  });
}

// 取消点赞
export function delFavorite(slug) {
  return request({
    method: 'DELETE',
    url: `/api/articles/${slug}/favorite`,
  });
}
